package com.ctshk.sapp.visa.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.visa.dto.visa.VisaOrderTouristDTO;
import com.ctshk.rpc.visa.req.visa.*;
import com.ctshk.rpc.visa.service.IVisaOrderTouristService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 签证旅客信息 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-28
 */
@Api(value="订单中心签证", tags="订单中心签证")
@RestController
@RequestMapping("/visa-order-tourist")
public class VisaOrderTouristController extends BaseController {
    @DubboReference
    private IVisaOrderTouristService iVisaOrderTouristService;

    @ApiOperation(value="签证旅客信息列表", notes="签证旅客信息列表(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "签证列表", operDesc = "签证列表")
    @PostMapping("/list")
    public Result<List<VisaOrderTouristDTO>> visaList(@RequestBody VisaOrderTouristReq visaOrderTouristReq) {
        return iVisaOrderTouristService.list(visaOrderTouristReq);
    }

    @ApiOperation(value="签证旅客信息登记", notes="签证旅客信息登记(黄利斌)")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "签证列表", operDesc = "签证列表")
    @PostMapping("/register")
    public Result register(@RequestBody VisaManageRegisterReq visaManageRegisterReq){
        Result register = iVisaOrderTouristService.register(visaManageRegisterReq, getCurrentUser(getRequest()));
        return register;
    }

    @ApiOperation(value = "签证旅客信息送签",notes = "签证旅客信息送签(黄利斌)")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "签证列表", operDesc = "签证列表")
    @PostMapping("/sendSign")
    public Result sendSign(@RequestBody VisaManageSignSendReq visaManageRegisterReq){
        return iVisaOrderTouristService.sendSign(visaManageRegisterReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "签证旅客信息出签成功",notes = "签证旅客信息出签成功(黄利斌)")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "签证列表", operDesc = "签证列表")
    @PostMapping("/signSuccess")
    public Result signSuccess(@RequestBody VisaManageSignSuccessReq visaManageRegisterReq){
        return iVisaOrderTouristService.signSuccess(visaManageRegisterReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value = "签证旅客信息出签失败",notes = "签证旅客信息出签失败(黄利斌)")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "签证列表", operDesc = "签证列表")
    @PostMapping("/signFailure")
    public Result signFailure(@RequestBody VisaManageSignFailureReq visaManageRegisterReq){
        return iVisaOrderTouristService.signFailure(visaManageRegisterReq,getCurrentUser(getRequest()));
    }

    @ApiOperation(value="签证管理列表", notes="签证管理列表(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "签证列表", operDesc = "签证列表")
    @PostMapping("/handle-list")
    public Result<List<VisaOrderTouristDTO>> handleList(@RequestBody VisaInfoReq visaInfoReq){
        return iVisaOrderTouristService.handleList(visaInfoReq);
    }

    @ApiOperation(value="修改旅客信息", notes="修改旅客信息(陈雷)")
    @OperationLogAnnotation(operModul = OperationLogModel.CUSTOM, operType = OperationLogType.QUERY, operTitle = "签证列表", operDesc = "签证列表")
    @PostMapping("/modify")
    public Result modify(@RequestBody VisaOrderTouristModifyReq visaOrderTouristModifyReq){
        return iVisaOrderTouristService.modify(visaOrderTouristModifyReq,getCurrentUser(getRequest()));
    }
}
